package com.kai.common.exception;

import lombok.Getter;

/**
 * <p>
 * 业务异常
 * </p>
 *
 * @author weijk
 * @since 2023/7/16
 */
public class BusinessException extends RuntimeException {

    private static final long serialVersionUID = 6231208795102733117L;

    @Getter
    private final int errorCode;

    public BusinessException(ErrorCode errorCode){
        super(errorCode.getMsg());
        this.errorCode = errorCode.getCode();
    }

    public BusinessException(String msg){
        super(msg);
        this.errorCode = ErrorCodeConstants.BASE_ERROR.getCode();
    }
}
